<template>
    <div class="container">
        <div class="left-panel"></div>
        <div class="right-panel">
            <div class="login-box">
                <div class="logo-section">
                    <img src="@/assets/logo.png" alt="Logo" class="logo" />
                    <div class="text-section">
                        <h2>党建平台</h2>
                        <p>江西师范大学软件学院党建平台</p>
                    </div>
                </div>
                <form @submit.prevent="handleLogin">
                    <div class="input-group">
                        <label for="username">用户名</label>
                        <input type="text" id="username" v-model="username" placeholder="请输入用户名" />
                    </div>
                    <div class="input-group">
                        <label for="password">密码</label>
                        <input type="password" id="password" v-model="password" placeholder="请输入密码" />
                    </div>
                    <button type="submit" class="login-button">立即登录</button>
                </form>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: "Login",
    data() {
        return {
            username: "",
            password: "",
        };
    },
    methods: {
        handleLogin() {
            // 模拟登录成功，打印用户名和密码并跳转到 Dashboard
            console.log("用户名:", this.username);
            console.log("密码:", this.password);

            // 跳转到 Dashboard 页面
            this.$router.push({ name: 'Dashboard' });
        },
    },
};
</script>

<style scoped>
/* 页面整体布局 */
.container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background-color: #f5f5f5; /* 设置整个页面的浅灰色背景 */
}

/* 左侧红色面板样式 */
.left-panel {
    flex: 1;
    background-color: #d9534f;
    clip-path: polygon(0 0, 70% 0, 50% 100%, 0 100%);
}

/* 右侧面板样式 */
.right-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 登录框样式 */
.login-box {
    width: 360px;
    padding: 40px;
    background-color: #ffffff;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    text-align: center;
}

/* 图标和文字水平排列 */
.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.logo {
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

.text-section h2 {
    margin: 0;
    font-size: 20px;
    color: #333333;
    font-weight: 600;
}

.text-section p {
    font-size: 12px;
    color: #666666;
    margin: 0;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    font-size: 14px;
    color: #555555;
    margin-bottom: 5px;
}

input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: #ff5722;
}

.login-button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background-color: #ff5722;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.login-button:hover {
    background-color: #e64a19;
}
</style>
